package com.goatrock.media.thisway.domain.filter.impl;

import com.goatrock.media.thisway.common.constants.ApplicationConstants;
import com.goatrock.media.thisway.common.model.Title;
import com.goatrock.media.thisway.common.util.StringUtils;
import com.goatrock.media.thisway.domain.filter.TitleFilter;
import java.util.Map;

public class YearFilterImpl implements TitleFilter{
    private String folderName = "Years";
    private String name = "Years";
    private String description = "Creates folders for each year and places a shortcut for each movie for that year in that folder.";
    
    public String[] execute(Map shortcutParams, Title title) {
        if(title != null && StringUtils.isNotBlank(title.getProductionYear())){
            return new String[] {folderName+"\\"+title.getProductionYear()};
        }else{
            return null;
        }
    }

    public boolean isExecutable(Map shortcutParams){
        String createYears = (String)shortcutParams.get(ApplicationConstants.CREATE_YEARS);
        if(createYears != null && createYears.equalsIgnoreCase(ApplicationConstants.PARAM_USE)){
            return true;
        }
        return false;
    }

    public String getFolderName(){
        return this.folderName;
    }
    public String getName() {
        return this.name;
    }

    public String getDescription() {
        return this.description;
    }

}
